package com.java.yz.day02;

import java.util.Scanner;
/*
    x和y满足的关系
    x>=3 y=2x+1
    -1<x<3 y=2x
    x<=-1  y=2x-1
 */
public class ScannerTest3 {
    public static void main(String[] args) {
        System.out.println("请输入x的值：");
        Scanner sc =new Scanner(System.in);
        int x = sc.nextInt();
        int y;
        if(x>=3){
            y=2*x+1;
            System.out.println("对应的函数值y为："+y);
        }
        else if(-1<x){
            y=2*x;
            System.out.println("对应的函数值y为："+y);
        }
        else{
            y=2*x-1;
            System.out.println("对应的函数值y为："+y);
        }
    }
}
